import axios_ from '@/utils/request'

// 查询字典类型列表
export function listType(query) {
  return axios_({
    url: '/api/dict/type/list',
    method: 'get',
    params: query
  })
}

// 查询字典类型详细
export function getType(dictId) {
  return axios_({
    url: '/api/dict/type/' + dictId,
    method: 'get'
  })
}

// 新增字典类型
export function addType(data) {
  return axios_({
    url: '/api/dict/type',
    method: 'post',
    data: data
  })
}

// 修改字典类型
export function updateType(data) {
  return axios_({
    url: '/api/dict/type',
    method: 'put',
    data: data
  })
}

// 删除字典类型
export function delType(dictId) {
  return axios_({
    url: '/api/dict/type/' + dictId,
    method: 'delete'
  })
}

// 批量删除字典类型
export function batchDeleteType(dictIds) {
  return axios_({
    url: '/api/dict/type/batch/' + dictIds,
    method: 'delete'
  })
}

// 获取字典选择框列表
export function optionselect() {
  return axios_({
    url: '/api/dict/type/all',
    method: 'get'
  })
}

// 查询字典数据列表
export function listData(query) {
  return axios_({
    url: '/api/dict/data/list',
    method: 'get',
    params: query
  })
}

// 查询字典数据详细
export function getData(dictCode) {
  return axios_({
    url: '/api/dict/data/' + dictCode,
    method: 'get'
  })
}

// 根据字典类型查询字典数据信息
export function getDictData(dictType) {
  return axios_({
    url: '/api/dict/data/type/' + dictType,
    method: 'get'
  })
}

// 新增字典数据
export function addData(data) {
  return axios_({
    url: '/api/dict/data',
    method: 'post',
    data: data
  })
}

// 修改字典数据
export function updateData(data) {
  return axios_({
    url: '/api/dict/data',
    method: 'put',
    data: data
  })
}

// 删除字典数据
export function delData(dictCode) {
  return axios_({
    url: '/api/dict/data/' + dictCode,
    method: 'delete'
  })
}

// 批量删除字典数据
export function batchDeleteData(dictCodes) {
  return axios_({
    url: '/api/dict/data/batch/' + dictCodes,
    method: 'delete'
  })
}
